import request from "@/utils/request"
import { AppThunk } from ".."
import { getDetail } from "../modules/detail"
// 3. 异步action
export const getDetailApi = (id?: number): AppThunk => {
  return async (dispatch, getState) => {
    const res = await request.get(`/articles/${id}`)
    console.log(res)
    dispatch(getDetail(res.data))
  }
}